<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <script src="/layui/layui.js"></script>
  <script src="/js/jquery/jquery-3.5.1.js"></script>
  <script src="/js/book/book.js"></script>
  <link rel="stylesheet" href="/layui/css/layui.css">
  <link rel="stylesheet" href="/css/bookList.css">
  <link rel="stylesheet" href="/css/readBook.css">
  <link rel="stylesheet" href="/component/pear/css/pear.css" />
  <script src="/component/pear/pear.js"></script>
  <script src="/js/book/common.js"></script>
  <title>数据管理</title>
</head>
<body>
<div class="page-style">
  <div class="content_read">
    <div class="table-css" id="read_content">
    </div>
  </div>
  <div class="footer">
    <div class="footer_cont"></div>
    <p>所有小说由蜘蛛程序自动抓取自网络公开资源，本站严格准守国家法律法规，拒绝任何色情、政治小说，一经发现，即作删除。</p>
  </div>
</div>

<script>
  debugger
  var chapterInfo = parent.chapterInfo;
 debugger
  if(chapterInfo.chapterContext.length==0){
    $.ajax({
      type: "post",
      url: '/BookAdmin/readBookChapter',
      data: JSON.stringify(parent.chapterInfo),
      dataType: "json",
      async: false,
      contentType: "application/json; charset=utf-8",
      success: function (res) {
        debugger;
        chapterInfo=res.data;
        //上下章目录按钮
        var udm = "<div class='udm'>" +
                "<a class='bottom-button' id='up'>上一章</a>" +" ← "+
                "<a class='bottom-button' id='menu'>返回章节</a>" +" → "+
                "<a class='bottom-button' id='next'>下一章</a>" +
                "</div>"
        //上下章目录按钮
        var udm2 = "<div class='udm2'>" +
                "<a class='bottom-button' id='up' >上一章</a>"+" ← "+
                "<a class='bottom-button' id='menu' >返回章节</a>"+" → "+
                "<a class='bottom-button' id='next' >下一章</a>"+
                "</div>"

        titleName=chapterInfo.chapterName;
        var titleText = chapterInfo.chapterContext;
        document.title = titleName;
        var bookName = "<div class='book_name'>" +
                "<h1>"+titleName+"</h1>" +udm+
                "</div>"
        var content = "<div class='content'>"+titleText+udm2+"</div>"

        $("#read_content").append(bookName);
        $("#read_content").append(content);
      }
    });
  }else{
    //上下章目录按钮
    var udm = "<div class='udm'>" +
            "<a class='bottom-button' id='up'>上一章</a>" +" ← "+
            "<a class='bottom-button' id='menu'>返回章节</a>" +" → "+
            "<a class='bottom-button' id='next'>下一章</a>" +
            "</div>"
    //上下章目录按钮
    var udm2 = "<div class='udm2'>" +
            "<a class='bottom-button' id='up' >上一章</a>" +" ← "+
            "<a class='bottom-button' id='menu' >返回章节</a>" +" → "+
            "<a class='bottom-button' id='next' >下一章</a>" +
            "</div>"
    titleName=chapterInfo.chapterName;
    var titleText = chapterInfo.chapterContext;
    document.title = titleName;
    var bookName = "<div class='book_name'>" +
            "<h1>"+titleName+"</h1>" +udm+
            "</div>"
    var content = "<div class='content'>"+titleText+udm2+"</div>"

    $("#read_content").append(bookName);
    $("#read_content").append(content);
  }

</script>
</body>
</html>